package com.zhouchao.rpc.consumer.controller;

import com.zhouchao.rpc.api.IUserService;
import com.zhouchao.rpc.consumer.proxy.RpcClientProxy;
import com.zhouchao.rpc.pojo.User;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: zhouchao
 * @Date: 2021/08/01 20:12
 * @Description:
 */
@RestController
public class UserController {

    @GetMapping("user/{id}")
    public User getUserById(@PathVariable int id){
        IUserService userService = RpcClientProxy.createProxy(IUserService.class);
        return userService.getUserById(id);
    }

}
